package com.bckj.freshnow.payment.pay;

import com.bckj.freshnow.common.constant.PaymentMethodConstants;
import com.bckj.freshnow.payment.pay.wxpay.WxJsapiPaymentService;
import com.bckj.freshnow.payment.pay.wxpay.WxRefundPaymentService;
import org.springframework.stereotype.Component;

@Component
public class PaymentServiceFactory {

    public PaymentService getPaymentService(String appId, String payWay) {
        PaymentService paymentService = null;
        switch (payWay) {
            case PaymentMethodConstants.WECHAT_PAY_JSAPI -> {
                paymentService = new WxJsapiPaymentService(appId);
            }
            case PaymentMethodConstants.WECHAT_REFUND -> {
                paymentService = new WxRefundPaymentService(appId);
            }
        }
        return paymentService;
    }
}
